package p7;

/**
 * @author krystal
 * @date 2022/11/11 21:59
 */
class MyValue{
    public int val;
}

public class Demo5 {
    public static void swap(MyValue mvl1,MyValue mvl2){
        int tmp=mvl1.val;
        mvl1.val=mvl2.val;
        mvl2.val=tmp;
    }

    public static void main(String[] args) {
        MyValue myValue1=new MyValue();
        myValue1.val=10;
        MyValue myValue2=new MyValue();
        myValue2.val=20;

        System.out.println(myValue1.val);
        System.out.println(myValue2.val);
        System.out.println("============");
        swap(myValue1,myValue2);
        System.out.println(myValue1.val);
        System.out.println(myValue2.val);
    }
}
